<!-- @format -->

<script setup>
	import { ref } from 'vue'

	// 计数器
	const count = ref(0)

	const increase = () => {
		count.value++
	}

	const add = (n) => {
		count.value += n
	}
</script>

<template>
	<div>
		<p>{{ count }}</p>
		<!-- 1. 内联/行内代码(一句话的时候)-->
		<button v-on:click="count++">+1</button>
		<!-- 2. 调用无参函数 -->
		<button v-on:click="increase">+1</button>
		<!-- 3. 调用有参函数 -->
		<button v-on:click="add(3)">+3</button>
		<button v-on:click="add(5)">+5</button>
		<!-- 4. 简写@ -->
		<button @click="add(5)">+5</button>
	</div>
</template>

<style scoped></style>
